package com.fengxu.gamescript.custom

import android.content.Context
import android.util.AttributeSet
import android.widget.ListView

/**
 * 自定义listView使其填充剩余空间
 */
class ScaleListView: ListView {
    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )

    constructor(
        context: Context?,
        attrs: AttributeSet?,
        defStyleAttr: Int,
        defStyleRes: Int
    ) : super(context, attrs, defStyleAttr, defStyleRes)


    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        var height = MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr  2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, height)
    }

}